<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ScheduleList.aspx.cs" Inherits="ScheduleList" Title="ABC SuperSign - Schedule List" %>
<%@ Register Src="UserAccess.ascx" TagName="UserAccess" TagPrefix="uc1" %>
<%@ Register Src="GlobalAjax.ascx" TagName="GlobalAjax" TagPrefix="uc2" %>
<asp:Content ID="Content_ScheduleList" ContentPlaceHolderID="ContentPlaceHolder_Main" Runat="Server">    
<form id="Form_ScheduleList" runat="server">
<asp:HiddenField ID="Hidden_BtnChoice" runat="server" />   
<asp:ScriptManager ID="ScriptManager_ScheduleList" runat="server">
</asp:ScriptManager>
<uc1:UserAccess ID="UserAccess1" runat="server" />
<!-- page title start -->
<script type="text/javascript">
    // wgo !!! testing out a doubleclick client side add function
    function addDay() {
        var calendarCtrl = $('<%= Calendar_Schedules.ClientID %>');            
        var selectedDayEl = calendarCtrl.getElementsByClassName('selectedDay');
        
        var dateStr = selectedDayEl.first().firstDescendant().readAttribute('title');
        //alert(dateStr);
        
        var listBoxCtrl = $('<%= ListBox_Selected.ClientID %>');
        var optionEl = document.createElement('option');
        optionEl.text = dateStr;
        listBoxCtrl.options.add(optionEl);
    }
</script>
<h1>
    <span>Schedule List</span>
</h1>
<!-- page title end -->
<!-- main content start -->
<div class="mainHolder">
<!-- left block start -->
<div class="leftBlock">
	<h2>
		<span>Find Schedules to Edit</span>
	</h2>
    <asp:UpdatePanel ID="UPanel_Find" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Btn_Remove" EventName="Click" />
        </Triggers>
        <ContentTemplate>
            <div class="innerContent">
                <div class="row">
                    <center>
                        <asp:Calendar ID="Calendar_Schedules" runat="server" FirstDayOfWeek="Monday" SelectionMode="DayWeek" Width="220" >
                            <SelectedDayStyle CssClass="selectedDay" />
                        </asp:Calendar>
                   </center>
                </div>
                <div class="row" style="margin:0 auto; width:203px;">
                    <asp:Button ID="Btn_AddWeek" runat="server" Text="Add Week" CssClass="aspButton" OnClick="Btn_AddWeek_Click" />
                    <div class="spacerS"></div>
                    <asp:Button ID="Btn_AddDay" runat="server" Text="Add Day" CssClass="aspButton" OnClick="Btn_AddDay_Click" />
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</div>
<!-- left block end -->
<!-- right block start -->
<div class="rightBlock">
	<asp:UpdatePanel ID="UPanel_Selected" runat="server">
     <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Btn_AddDay" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="Btn_AddWeek" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="ListBox_Selected" EventName="SelectedIndexChanged" />
    </Triggers>
    <ContentTemplate>
	    <h2>
		    <span>Selected Schedules</span>
	    </h2>
        <div class="innerContent">
	        <div class="col widthM">
	            <div class="row">
		            <label class="big">
			            <span>Schedules (7 Maximum)</span>
				    </label>	
                    <asp:ListBox ID="ListBox_Selected" runat="server" CssClass="heightL widthM" AutoPostBack="true" OnSelectedIndexChanged="ListBox_Selected_SelectedIndexChanged"></asp:ListBox>
                </div>
                <div class="row">
                    <asp:Button ID="Btn_EditAll" runat="server" Text="Edit All Schedules in List" Enabled="false" CssClass="widthM" OnClick="Btn_EditAll_Click" PostBackUrl="~/Editor.aspx" />
			    </div>
			    <div class="row">
                    <asp:Button ID="Btn_RemoveAll" runat="server" Text="Remove All Schedules in List" Enabled="false" CssClass="widthM" OnClick="Btn_RemoveAll_Click" />
			    </div>
		    </div>
		    <div class="spacerXL"></div>
	        <div class="col">
		        <div class="row">
			        <label class="big">Schedule Info</label>
			    </div>
			    <div class="row">
                    <asp:Panel ID="Panel_ScheduleInfo" runat="server" CssClass="aspPanel heightM widthM">
                        <asp:Label ID="NameLabel" runat="server" Text=""></asp:Label>
                    </asp:Panel>
                </div>
		    </div>
		    <div class="spacerXL"></div>
	        <div class="col">
	            <div class="row">
		            <label>&nbsp;</label>
		        </div>
		        <div class="row">
			        <asp:Button ID="Btn_Edit" runat="server" Text="Edit Selected Schedule" Enabled="false" CssClass="widthM" PostBackUrl="~/Editor.aspx" />
			    </div>
			    <div class="row">
                    <asp:Button ID="Btn_Remove" runat="server" Text="Remove Schedule from List" Enabled="false" OnClick="Btn_Remove_Click" CssClass="aspButton widthM" />
                </div>
		    </div>
	    </div>
    </div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<!-- right block end -->
</div>
<!-- main content end -->
</form>
</asp:Content>